import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';

import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '工作内容',
    align:"center",
    dataIndex: 'jobContent'
   },
   {
    title: '质量要求',
    align:"center",
    dataIndex: 'qualityRequirements'
   },
   {
    title: '周期单位',
    align:"center",
    dataIndex: 'periodicUnits_dictText'
   },
  {
    title: '数量',
    align:"center",
    dataIndex: 'quantity'
  },
   {
    title: '下次汇报时间',
    align:"center",
    dataIndex: 'nextReportTime',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },
   {
    title: '是否生效',
    align:"center",
    dataIndex: 'whetherEffect_dictText'
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '工作内容',
    field: 'jobContent',
    component: 'InputTextArea',
  },
  {
    label: '质量要求',
    field: 'qualityRequirements',
    component: 'InputTextArea',
  },
  {
    label: '周期单位',
    field: 'periodicUnits',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"periodicunits"
    },
  },
  {
    label: '数量',
    field: 'quantity',
    component: 'InputNumber',
  },
  {
    label: '下次汇报时间',
    field: 'nextReportTime',
    component: 'DatePicker',
    componentProps:{
      valueFormat: 'YYYY-MM-DD'
    },    
  },
  {
    label: '是否生效',
    field: 'whetherEffect',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"whethereffect"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const periodicWorkCoopdeptColumns: JVxeColumn[] = [
    {
      title: '配合部门',
      key: 'coopDepart',
      type: JVxeTypes.select,
      dictCode:"sys_depart where depart_name like '%部' or depart_name like '%处',depart_name,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '协作内容',
      key: 'coopContent',
      type: JVxeTypes.textarea,
      width:"240px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '质量要求',
      key: 'qualityRequirements',
      type: JVxeTypes.textarea,
      width:"240px",
      placeholder: '请输入${title}',
      defaultValue:'',
    }
  ]


// 高级查询数据
export const superQuerySchema = {
  jobContent: {title: '工作内容',order: 0,view: 'textarea', type: 'string',},
  qualityRequirements: {title: '质量要求',order: 1,view: 'textarea', type: 'string',},
  periodicUnits: {title: '周期单位',order: 2,view: 'text', type: 'string',},
  nextReportTime: {title: '下次汇报时间',order: 3,view: 'date', type: 'string',},
  whetherEffect: {title: '是否生效',order: 4,view: 'text', type: 'string',},
  supervisorOfResponsibility: {title: '责任主管',order: 5,view: 'text', type: 'string',},
  //子表高级查询
  periodicWorkCoopdept: {
    title: '周期性工作配合部门',
    view: 'table',
    fields: {
        mainId: {title: '主表id',order: 0,view: 'text', type: 'string',},
        coopDepart: {title: '配合部门',order: 1,view: 'text', type: 'string',},
        coopContent: {title: '协作内容',order: 2,view: 'textarea', type: 'string',},
        qualityRequirements: {title: '质量要求',order: 3,view: 'textarea', type: 'string',},
        coopDepartTaskstatus: {title: '配合部门任务状态',order: 4,view: 'text', type: 'string',},
        cooperateWithTheSupervisor: {title: '配合主管',order: 5,view: 'text', type: 'string',},
        coopSuperTaskstatus: {title: '配合主管任务状态',order: 6,view: 'text', type: 'string',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
